<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
    <script src="../../js/dayjs.js"></script>
</head>
<body>
    <div id="app">
        <h1>转换成时间戳：{{dayjs('2024-04-30').valueOf()}}</h1>
        <h1>时间戳：{{new Date().getTime()}}</h1>
        <h1>根据显示格式化时间</h1>
        <h2>计算属性实现</h2>
        <span>现在的时间是：{{fmtdate}}</span>
        <h2>methods实现</h2>
        <span>现在的时间是：{{getDateTime()}}</span>
    </div>
</body>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                isShow: true,
                dates:'1714461811908'
            },
            computed:{
                fmtdate(){
                    return dayjs().format("YYYY-MM-DD HH:mm:ss");
                }
            },
            methods: {
                getDateTime(){
                    return dayjs(this.dates).format("YYYY-MM-DD HH:mm:ss");
                }
            },
        });
    </script>
</html>